//
//  String_Common.swift
//  PhotoLine
//
//  Created by 吴帅 on 2017/11/20.
//  Copyright © 2017年 PhotoLine. All rights reserved.
//

import Foundation

extension String {
    public func swiftClassFromString<AnyClass>() -> AnyClass! {
        // get the project name
        if  let appName: String = Bundle.main.infoDictionary!["CFBundleExecutable"] as! String? {
            //拼接控制器名
            let classStringName = "\(appName).\(self)"
            //将控制名转换为类
            let classType = NSClassFromString(classStringName) as? AnyClass.Type
            if let type = classType {
                return type as! AnyClass
            }
        }
        return nil;
    }
}

